package com.xiaoyi.springboot.exception;

import com.xiaoyi.springboot.enums.ExceptionInfoEnum;
import lombok.Data;

@Data
public class CommonException extends RuntimeException {
	private static final long serialVersionUID = 1L;
	private final String errorCode;
	public CommonException(String msg, String code) {
		super(msg);
		this.errorCode = code;
	}
	public CommonException(String errorMsg) {
		super(errorMsg);
		this.errorCode = ExceptionInfoEnum.ERROR.getErrorCode();
	}

	public CommonException(String errorMsg, Throwable e) {
		super(errorMsg,e);
		this.errorCode = ExceptionInfoEnum.ERROR.getErrorCode();
	}


	public CommonException(ExceptionInfoEnum e) {
		super(e.getErrorMsg());
		this.errorCode = e.getErrorCode();
	}
}
